/**
 * PreCreateResources
 * @ 预创建资源 与 图片精灵
 */
export default {
  // 加载资源
  getResource: function () {
    const resource = []
    for (let i = 0; i < 50; i += 1) {
      resource.push({
        name: `ani${i}`,
        url: require(`../../static/imgs/ani/${701 + i}.png`)
      })
    }
    for (let i = 0; i < 62; i += 1) {
      resource.push({
        name: `girl${i}`,
        url: require(`../../static/imgs/girl/${160 + i}.png`)
      })
    }
    for (let i = 1; i < 8; i += 1) {
      resource.push({
        name: `item${i}`,
        url: require(`../../static/imgs/items/${i}.png`)
      })
    }
    for (let i = 0; i < 25; i += 1) {
      resource.push({
        name: `plane${i}`,
        url: require(`../../static/imgs/plane/${408 + i}.png`)
      })
    }
    return resource
  },
  // 精灵属性
  getSprites: function () {
    const sprites = {
      ani: {
        key: 'ani0',
        size: { mode: 'widthFit', width: 1 },
        position: 'center',
        anchor: 'center'
      },
      girl: {
        key: 'girl0',
        size: { mode: 'widthFit', width: 1 },
        position: 'center',
        anchor: 'center'
      },
      plane: {
        key: 'plane0',
        size: { mode: 'widthFit', width: 0.5 },
        position: {
          x: 0.5, y: 0.4
        },
        anchor: 'center'
      }
    }
    for (let i = 1; i < 8; i += 1) {
      const x = i % 2 === 0 ? 1.1 : -0.1
      sprites[`item${i}`] = {
        key: `item${i}`,
        size: { mode: 'widthFit', width: 0.8 },
        position: { x, y: 1.4 },
        anchor: 'center'
      }
    }
    return sprites
  }
}
